<!--
 * @Author: zheng yong tao
 * @Date: 2022-01-15 15:34:05
 * @LastEditors: zheng yong tao
 * @LastEditTime: 2022-01-27 00:54:56
 * @Description: 
-->
<template>
  <div>
    <div class="head-block">
      <div class="search-text">
        <div>
          <p>The atoms Blockchain Explorer</p>
          <el-input
            placeholder="enter projectName or version to search your report"
            v-model="keyword"
          >
            <!-- <template slot="prepend">
              <el-select v-model="value" placeholder="allfilter">
                <el-option
                  v-for="item in options"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </template> -->
            <template slot="append">
              <el-button type="primary" @click="selectKeyData"
                >search</el-button
              ></template
            >
          </el-input>
          <p>
            On this platform, you can review the security of contracts, includes
            almost all smart contract audit status of Bscscan, Ehterscan and
            Tronscan, and updates the contract audit status regularly every day
          </p>
        </div>
      </div>
      <div style="width:5vw"></div>
      <div class="submit-form">
        <div
          style="color: white;
    padding: 20px;
    
    border-radius: 20px;"
        >
          <submitInfo />
        </div>
      </div>
    </div>
    <div>
      <el-carousel :interval="4000" type="card" height="200px">
        <el-carousel-item v-for="item in 6" :key="item">
          <h3 class="medium">{{ item }}</h3>
        </el-carousel-item>
      </el-carousel>
    </div>
    <div class="list-block">
      <article-list
        :title="'deep'"
        :allArticles="allArticles"
        @refreshData="initData"
      ></article-list>
      <article-list
        :title="'standard'"
        :allArticles="allArticles1"
        @refreshData="initData1"
      ></article-list>
    </div>
  </div>
</template>

<script>
import articleList from "@/components/article/articleList.vue";
import submitInfo from "./submitInfo.vue";
import { getBlogs } from "@/config/api";
export default {
  name: "homePage",
  components: {
    articleList,
    submitInfo
  },
  data() {
    return {
      options: [
        {
          value: "address",
          label: "address"
        },
        {
          value: "name",
          label: "name"
        },
        {
          value: "high",
          label: "high"
        }
      ],
      value: "",
      allArticles: [],
      allArticles1: [],
      keyword: ""
    };
  },
  mounted() {
    this.initData();
    this.initData1();
  },
  methods: {
    async selectKeyData(param) {
      const description = this.keyword;
      const res = await this.httpGet(getBlogs, { description: description });
      res.code == 1
        ? (this.allArticles = res.data)
        : this.$message.success(res.msg);
    },
    async initData() {
      const res = await this.httpGet(getBlogs, { type: "deep" });
      res.code == 1
        ? (this.allArticles = res.data)
        : this.$message.success(res.msg);
    },
    async initData1() {
      const res = await this.httpGet(getBlogs, { type: "standard" });
      res.code == 1
        ? (this.allArticles1 = res.data)
        : this.$message.success(res.msg);
    }
  },
  beforeDestroy() {}
};
</script>

<style lang="scss">
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 200px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  background-color: #d3dce6;
}
.el-form-item__label {
  color: #fff;
}
@media screen and (max-width: 980px) {
  .head-block {
    display: block;
    background: #66b1ff21;
    color: white;
    text-align: left;
  }
  .search-text {
    width: 100vw;
  }
  .submit-form {
    width: 100vw;
  }
  .list-block {
    display: block;
    height: 100vh;
    //flex-wrap: wrap;
  }
  .article-list {
    width: 90vw !important;
  }
}
@media screen and (min-width: 980px) {
  .head-block {
    display: flex;
    background: #66b1ff21;
    color: white;
    text-align: left;
  }
  .search-text {
    width: 45vw;
  }
  .submit-form {
    width: 45vw;
  }
  .list-block {
    display: flex;
    flex-wrap: wrap;
  }
  .article-list {
    width: 40vw !important;
  }
}
</style>
